package com.huike.web.controller.report;


import com.huike.clues.service.ISysUserService;
import com.huike.common.core.domain.entity.SysUser;
import com.huike.common.utils.SecurityUtils;
import com.huike.common.utils.StringUtils;
import com.huike.report.domain.vo.IndexTodayInfoVO;
import com.huike.report.domain.vo.IndexTodoInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.time.LocalDate;
import java.time.LocalDateTime;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }

    /**今日简报部分数据
     * 功能描述:
     * @return com.huike.common.core.domain.AjaxResult
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo(){

        String nowTime = LocalDate.now().toString();

        IndexTodayInfoVO todayInfo = reportService.getTodayInfo(nowTime);

        return AjaxResult.success(todayInfo);
    }

    /**
     *  首页--今日待办
     * @param beginCreateTime
     * @param endCreateTime
     * @return com.huike.common.core.domain.AjaxResult
     */
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(String beginCreateTime, String endCreateTime){

        System.out.println("开始时间 ： " + beginCreateTime);
        System.out.println("结束时间 ： " + endCreateTime);

        IndexTodoInfoVO indexTodoInfoVO = reportService.getTodoInfo(beginCreateTime, endCreateTime);

        return AjaxResult.success(indexTodoInfoVO);
    }



}